﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class boss : MonoBehaviour
{//0,1,2是障碍，3是墙，4是敌人
    public GameObject[] mapcomponents;

    private void Awake()
    {
        for(int i = -10; i < 11; i++)
        {
            for(int j = -7; j<8; j++)
            {
                if (j == -7 && i <= 1 && i >= -1) continue;
                int num = Random.Range(0, 100);
                if (num <= 8) create(mapcomponents[0], new Vector3(i, j, 0), Quaternion.identity);
                if (num >8 && num <= 16) create(mapcomponents[1], new Vector3(i, j, 0), Quaternion.identity);
                if (num > 16 && num <= 32) create(mapcomponents[2], new Vector3(i, j, 0), Quaternion.identity);
                if (num > 32 && num <= 50) create(mapcomponents[3], new Vector3(i, j, 0), Quaternion.identity);
            }
        }
        for(int i = -10; i < 11; i++)
        {
            int num1 = Random.Range(0, 100);
            if (num1 <= 20) create(mapcomponents[4], new Vector3(i, 8, 0), Quaternion.identity);
        }
    }
    private void create(GameObject obj, Vector3 v3, Quaternion Q4)
    {
        GameObject go =  Instantiate(obj, v3, Q4);
        go.transform.SetParent(GameObject.Find("gamemanager").transform);
    }
}
